package bonecp.bonecp_src_read;

import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;

import com.jolbox.bonecp.ConnectionHandle;
import com.jolbox.bonecp.StatementHandle;
import com.jolbox.bonecp.hooks.AbstractConnectionHook;
import com.jolbox.bonecp.hooks.AcquireFailConfig;
import com.jolbox.bonecp.hooks.ConnectionState;

public class MyConnectionHook extends AbstractConnectionHook {

	@Override
	public void onAcquire(ConnectionHandle connection) {
		super.onAcquire(connection);
		System.out.println("onAcquire");
	}

	@Override
	public void onCheckIn(ConnectionHandle connection) {
		super.onCheckIn(connection);
		System.out.println("onCheckIn");
	}

	@Override
	public void onCheckOut(ConnectionHandle connection) {
		super.onCheckOut(connection);
		System.out.println("onCheckOut");
	}

	@Override
	public void onDestroy(ConnectionHandle connection) {
		super.onDestroy(connection);
		System.out.println("onDestroy");
	}

	@Override
	public boolean onAcquireFail(Throwable t, AcquireFailConfig acquireConfig) {
		// TODO Auto-generated method stub
		System.out.println("onAcquireFail");
		return super.onAcquireFail(t, acquireConfig);
	}

	@Override
	public void onQueryExecuteTimeLimitExceeded(ConnectionHandle handle,
			Statement statement, String sql, Map<Object, Object> logParams,
			long timeElapsedInNs) {
		// TODO Auto-generated method stub
		System.out.println("onQueryExecuteTimeLimitExceeded");
		super.onQueryExecuteTimeLimitExceeded(handle, statement, sql, logParams,
				timeElapsedInNs);
	}

	@Override
	public void onQueryExecuteTimeLimitExceeded(ConnectionHandle handle,
			Statement statement, String sql, Map<Object, Object> logParams) {
		// TODO Auto-generated method stub
		System.out.println("onQueryExecuteTimeLimitExceeded");
		super.onQueryExecuteTimeLimitExceeded(handle, statement, sql, logParams);
	}

	@Override
	public void onQueryExecuteTimeLimitExceeded(String sql,
			Map<Object, Object> logParams) {
		// TODO Auto-generated method stub
		System.out.println("onQueryExecuteTimeLimitExceeded");
		super.onQueryExecuteTimeLimitExceeded(sql, logParams);
	}

	@Override
	public boolean onConnectionException(ConnectionHandle connection,
			String state, Throwable t) {
		// TODO Auto-generated method stub
		System.out.println("onConnectionException");
		return super.onConnectionException(connection, state, t);
	}

	@Override
	public void onBeforeStatementExecute(ConnectionHandle conn,
			StatementHandle statement, String sql, Map<Object, Object> params) {
		// TODO Auto-generated method stub
		System.out.println("onBeforeStatementExecute");
		super.onBeforeStatementExecute(conn, statement, sql, params);
	}

	@Override
	public void onAfterStatementExecute(ConnectionHandle conn,
			StatementHandle statement, String sql, Map<Object, Object> params) {
		// TODO Auto-generated method stub
		System.out.println("onAfterStatementExecute");
		super.onAfterStatementExecute(conn, statement, sql, params);
	}

	@Override
	public ConnectionState onMarkPossiblyBroken(ConnectionHandle connection,
			String state, SQLException e) {
		// TODO Auto-generated method stub
		System.out.println("onMarkPossiblyBroken");
		return super.onMarkPossiblyBroken(connection, state, e);
	}
	
}
